#include <iostream>
#include <sw/redis++/redis++.h>
using namespace sw::redis;
using namespace std;

int main()
{
    // Create an Redis object, which is movable but NOT copyable.
    Redis redis = Redis("tcp://127.0.0.1:6379");

    // ***** STRING commands *****

    // redis.set("key", "val");
    auto val = redis.get("key"); // val is of type OptionalString. See 'API Reference' section for details.
    if (val)
    {
        // Dereference val to get the returned value of std::string type.
        std::cout << *val << std::endl;
    } // else key doesn't exist.

    // redis.set("man", "men");
    val = redis.get("man");
    if (val)
    {
        std::cout << *val << std::endl;
    }

    val = redis.get("test");
    if (val)
    {
        std::cout << *val << std::endl;
    }
    else
    {
        std::cout << "not exist" << std::endl;
    }

    

    return 0;
}